<?php

namespace app\index\model;

use think\Model;
use think\model\concern\SoftDelete;

class Follow extends Model
{
    use SoftDelete;
    protected $deleteTime = 'delete_time';
    protected $defaultSoftDelete = 0;
    public function userInfo()
    {
        return $this->hasOne(User::class, 'id', 'follow_user_id');
    }
    public static function list($uid)
    {
        $list = self::where(['user_id' => $uid, 'delete_time' => 0])->with(['userInfo' => function ($query) {
            $query->field('id,head_icon,nickname');
        }])->paginate(10);
        return $list;
    }
}
